#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
int main()
{
	int n, num, sum = 0, t = 0, count1 = 0, count2 = 0;
	scanf("%d", &n);

	for (int i = 0; i < n; i++)
	{
		scanf("%d", &num);
		if (num % 3 == 0)
		{
			if (num > t)
				t = num;
		}

		if (num % 3 == 1)
			count1++;

		if (num % 3 == 2)
		{
			count2++;
			sum += num;
		}
	}

	if (t == 0)
		printf("NONE ");
	if (t != 0)
		printf("%d ", t);
	if (count1 == 0)
		printf("NONE ");
	if (count1 != 0)
		printf("%d ", count1);
	if (count2 == 0)
		printf("NONE");
	if (count2 != 0)
		printf("%.1lf", sum * 1.0 / count2);
	return 0;
}